//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package come.tool.JDialog;

import com.tool.btn.BaptizeBtn;
import org.come.Frame.ZhuFrame;
import org.come.entity.Goodstable;
import org.come.mouslisten.GoodsMouslisten;
import org.come.until.AccessSuitMsgUntil;
import org.come.until.GoodsListFromServerUntil;
import org.come.until.Goodtype;
import org.come.until.Util;

public class GoodDiscatdJDialog implements TiShiChuLi {
    public GoodDiscatdJDialog() {
    }

    @Override
    public void tipBox(boolean tishi, Object object) {
        if (tishi) {
            if (Util.isCanBuyOrno()) {
                return;
            }

            Goodstable good = GoodsListFromServerUntil.getGoodslist()[GoodsMouslisten.replace];
            if (good.getGoodlock() == 1) {
                ZhuFrame.getZhuJpanel().addPrompt("该物品已加锁，不可丢弃");
                return;
            }

            if (good.getGoodTimeLock() > 0) {
                ZhuFrame.getZhuJpanel().addPrompt("该物品已被 #R时间锁 #Y保护,不可丢弃");
                return;
            }

            if (Goodtype.EquipmentType(good.getType()) != -1 && AccessSuitMsgUntil.getExtra(good.getValue(), BaptizeBtn.Extras[4]) != null) {
                ZhuFrame.getZhuJpanel().addPrompt2("已镶嵌宝石无法丢弃");
                return;
            }

            good.setUsetime(0);
            GoodsMouslisten.gooduse(good, 1);
            GoodsListFromServerUntil.Delete(GoodsMouslisten.replace);
            GoodsMouslisten.goodreplace(-1, -1);
        } else {
            GoodsMouslisten.goodreplace(-1, -1);
        }

    }

    public void clearAllBack() {
        int len = GoodsListFromServerUntil.getGoodslist().length;

        for(int i = 0; i < len; ++i) {
            Goodstable good = GoodsListFromServerUntil.getGoodslist()[i];
            if (good != null) {
                if (good.getGoodlock() == 1) {
                    ZhuFrame.getZhuJpanel().addPrompt("该物品已加锁，不可丢弃。。");
                } else if (Goodtype.EquipmentType(good.getType()) != -1 && AccessSuitMsgUntil.getExtra(good.getValue(), BaptizeBtn.Extras[4]) != null) {
                    ZhuFrame.getZhuJpanel().addPrompt2("已镶嵌宝石无法丢弃");
                } else if (good.getType() == 2010L) {
                    good.setUsetime(0);
                    GoodsMouslisten.gooduse(good, 1);
                    GoodsListFromServerUntil.Delete(i);
                    GoodsMouslisten.goodreplace(-1, -1);
                }
            }
        }

    }
}
